package com.luckku.boot.controller;

import com.luckku.boot.common.api.ApiResult;
import com.luckku.boot.model.entity.Cart;
import com.luckku.boot.model.entity.Store;
import com.luckku.boot.service.IStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author luckku
 * @date 2021/12/18
 */

@Controller
@RequestMapping("/store")
public class StoreController {


    @Autowired
    IStoreService storeService;

    /**
     * /store/getStoreInfo
     * 根据id获取店铺
     */
    @ResponseBody
    @GetMapping("/getStoreInfo")
    public ApiResult<Store> getStoreInfo(@RequestParam("storeId") String storeId) {
        Store store = storeService.getById(storeId);
        return ApiResult.success(store);
    }

    /**
     * /store/getStoreList
     * 获取店铺列表
     */
    @ResponseBody
    @GetMapping("/getStoreList")
    public ApiResult<List<Store>> getStoreList() {
        List<Store> storeList = storeService.list();
        return ApiResult.success(storeList);
    }


}
